tell application "Motion Pictures"
	tell document 1
		set the_movie_path to last exported file
		set the_movie_title to last exported title
		set send_movie to send movie
		set send_images to send images
		set image_count to count images
		set image_file_list to {}
	end tell
end tell

repeat with n from 1 to image_count
	tell application "Motion Pictures" to set the_path to image file path of image n of document 1
	copy POSIX file the_path to the end of image_file_list
end repeat

set the_movie to ""
if  the_movie_path  "" then
    set the_movie to POSIX file the_movie_path
end if

if the_movie_title = "" then
	set the_movie_title to " "
end if

tell application "%@"
    activate
	set the_disc to make new Video disc
	tell the_disc
		set disc format to DVD
		set create menu to true
		set name to the_movie_title
		if send_movie = 1 then
            if the_movie  ""
                add to it items the_movie
                set track_num to number of tracks
                -- we modify the first menu text line and set the third line to an empty string
                set description1 of video track track_num to the_movie_title
                set description3 of video track track_num to " "
                -- the first frame of the movie is going to be our menu thumbnail
                set preview picture of video track track_num to 3
            end if
		end if
		if send_images = 1 then
			if (count of image_file_list) > 0 then
				add to it items image_file_list
				set track_num to number of tracks
				-- we modify the first menu text line and set the third line to an empty string
				set description1 of video track track_num to the_movie_title
				set description3 of video track track_num to " "
				-- the first frame of the movie is going to be our menu thumbnail
				set preview picture of video track track_num to 1
			end if
		end if
	end tell
end tell
